Clarify that Set-ItResult ends the It block (Pester v5 Skip section)#1857
Merged
aaronpowell merged 1 commit intoMay 28, 2026
Merged
Conversation
Set-ItResult -Skipped/-Inconclusive throws internally to end the It block, so code after it does not run and a trailing return is unreachable. Documenting this prevents the recurring suggestion to add a redundant return after Set-ItResult. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🟡 Contributor Reputation Check: MEDIUM risk
Maintainers: please review this contributor before merging. |
aaronpowell
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.stagedbranch for this pull request.Description
Adds one bullet to the Skip section of
instructions/powershell-pester-5.instructions.mdclarifying that
Set-ItResult -Skipped/-Inconclusiveends the currentItblock:The existing "Runtime Skip" bullet notes that setup/teardown still run, but doesn't say the call
ends the current test body. Without that, it's a common mistake to add a
returnafterSet-ItResult— automated reviewers (including Copilot's PR reviewer) recurrently suggest it —which is unreachable dead code.
This is verified by Pester's implementation:
Set-ItResultends inthrow [Pester.Factory]::CreateErrorRecord(...), which unwinds theItblock for Pester to catchand record as the result. Confirmed empirically on Pester 5.7.1: an
Itthat callsSet-ItResult -Skippedfollowed bythrowreports Skipped, not Failed — the statement afterthe skip never executes.
Type of Contribution
Additional Notes
npm start(update-readme+generate-marketplace) produces no diff toREADME.mdormarketplace.json, since the change is in the file body rather than its title/description.runtime behavior rather than a new Copilot-facing instruction; the claim is verified against
Pester's source and runtime as described above.
By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and
will be licensed under the MIT License.